package nachos.network;
import nachos.machine.*;
import nachos.threads.*;
import java.util.LinkedList;
import java.util.PriorityQueue;

public class Socket extends OpenFile {

	//main point of our socket class is to store connection information from 2 different "nodes"
	
	Socket(int port){
		this.port = port;
		this.srcLink = Machine.networkLink().getLinkAddress();
		dstPort = -1;
		dstLink = -1;

	}
	Socket(EnhancedPacket packet){
		dstPort = packet.dstPort;
		dstLink = packet.packet.dstLink;
		srcPort = packet.srcPort;
		srcLink = packet.srcLink;
	}
	
	Socket(int _srcLink, int _srcPort, int _dLink, int _dPort){
		srcLink = _srcLink;
		srcPort = _srcPort;
		dstLink = _dLink;
		dstPort = _dPort;
	}
	
	//socket status
	enum socketState{
		CLOSED(0),SYN_SENT(1),SYN_RCVD(2),ESTABLISHED(3),STP_RCVD(5),STP_SENT(4),CLOSING(6),DEADLOCK(7),VIOLATION(8);
		int id;
		socketState(int id){this.id = id;}
	}
	//overriding the openfile functions
	public int read(byte[] buffer, int offset, int length) {
		return -1;
	}
	
	public int write(byte[] buffer, int offset, int length) {
		return -1;
	}
	
	
	int port, dstPort, dstLink, srcLink, srcPort;
	byte[] contents;

//	public int currentState;
	//private ExtendedSynchList senddumpBox;
//	private PriorityQueue<EnhancedPacket> receiveInbox;
//	private ExtendedSynchList[] receiveInbox; 
	//private ExtendedSynchList[] sendOutbox; //array offsets.length long, holds outgoing messages (unlimited capacity) 
	
}